const db = require('../../utils/db.js')


exports.insertArticle = async function(value) {
    let {content, title} = value
    const date = new Date();  
    const formattedDate = date.toISOString().slice(0, 19).replace('T', ' '); 
    let sql = `INSERT INTO t_article (title, content, user_id) VALUES ('${title}', '${content}', 1)`
    db.query(sql, (err, data) => {
        if (err) {
            throw err
        } else {
            return data
        }
    })
}
